package com.zyx.wanshu.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zyx
 * @since 2022/7/15 23:20
 * desc: 页面映射配置
 */
@Configuration
public class MyWebViewConfiguration implements WebMvcConfigurer {
    /**
     * 视图映射器
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login.html").setViewName("/login");
        // registry.addViewController("/home.html").setViewName("/home");
        registry.addViewController("/index_v1.html").setViewName("/index_v1");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry
                .addResourceHandler("/resources/**")
                .addResourceLocations("file:./src/", "/resources/");
    }
}
